package log;

public class LogInfo {
    private String sourceIp;
    private String sourceIdentity;
    private String id;
    private String timeStamp;
    private String method;
    private String requestedResource;
    private int statusCode;
    private int size;
    private String referer;

    @Override
    public String toString() {
        String info = "";
        if(!sourceIp.isEmpty()) {
            info = info + sourceIp + "--";
        }

        if(!timeStamp.isEmpty()) {
            info = info + "[" + timeStamp + "] ";
        }

        if(!sourceIdentity.isEmpty()) {
            info = info + "identity:" + sourceIdentity + " ";
        }

        if(!id.isEmpty()) {
            info = info + "ID" + id + " ";
        }

        if(!method.isEmpty()) {
            info = info + "\"" + method + "\" ";
        }

        if(!requestedResource.isEmpty()) {
            info = info + requestedResource + " ";
        }

        if(statusCode != 0) {
            info = info + statusCode + " ";
        }

        if(size != 0) {
            info = info + size + " ";
        }

        if(!referer.isEmpty()) {
            info = info + "\"" + referer + "\"";
        }

        return info.trim();
    }

    public String getSourceIp() {
        return sourceIp;
    }

    public void setSourceIp(String sourceIp) {
        this.sourceIp = sourceIp;
    }

    public String getSourceIdentity() {
        return sourceIdentity;
    }

    public void setSourceIdentity(String sourceIdentity) {
        this.sourceIdentity = sourceIdentity;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(String timeStamp) {
        this.timeStamp = timeStamp;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getRequestedResource() {
        return requestedResource;
    }

    public void setRequestedResource(String requestedResource) {
        this.requestedResource = requestedResource;
    }

    public int getStatusCode() {
        return statusCode;
    }

    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getReferer() {
        return referer;
    }

    public void setReferer(String referer) {
        this.referer = referer;
    }
}
